#set(String masterMenu = "1")
#set(String sysActiveMenu = "3")
#tag layout_block("sidebar")
	#include("/fragment/menu.html")
#end
#tag layout_block("main")
	<div id="repast-manager" v-cloak>
		<div class="col-xs-offset-1 col-xs-4">
			<div class="form-group">
				<input type="text" class="form-control" placeholder="请输入桌位编码" v-model="searchName">
			</div>
		</div>
		<div class="col-xs-2">
			<div class="form-group">
				<select class="form-control" v-model="searchType">
					<option value="">桌位类型</option>
					<option v-for="val in dicType" value="{{$key}}">{{val}}</option>
				</select>
			</div>
		</div>
		<div class="col-xs-2">
			<div class="form-group">
				<select class="form-control" v-model="searchState">
					<option value="">使用状态</option>
					<option value="0">未使用</option>
					<option value="1">已使用</option>
				</select>
			</div>
		</div>
		<div class="col-xs-3">
			<button type="button" class="btn btn-primary" @click="reloadContent(0)">查询</button>
		</div>
		<div class="col-xs-12">
			<table class="table table-hover custom-table">
				<thead>
					<tr>
						<th>序号</th>
						<th>编码</th>
						<th>类型</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="item in content">
						<td>{{page*size+$index+1}}</td>
						<td>{{item.NUM}}</td>
						<td>{{dicType[item.TYPE]}}</td>
						<td>
							<span v-show="!item.REPASTID" class="label label-success">未使用</span>
							<span v-else class="label label-danger">已使用</span>
						</td>
						<td>
							<button v-if="!item.REPASTID" type="button" class="btn btn-xs btn-success" @click="createRecord(item)">生成就餐单</button>
							<button v-if="item.REPASTID" class="btn btn-xs btn-danger" @click="operMenu(item)">菜单</button>
							<button v-if="item.REPASTID" class="btn btn-xs btn-danger" @click="editRecord(item)">结账</button>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="col-xs-12 archive-pages text-center" id="laypage-ctl"></div>
		<!-- Modal -->
		<div class="modal fade" id="repast-modal" tabindex="-1" role="dialog"
			aria-labelledby="repastModalLabel" aria-hidden="true" data-backdrop="static">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
						</button>
						<h4 class="modal-title" id="repastModalLabel">结账</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" role="form" style="margin-top: 10px;">
							<div class="form-group">
								<label class="col-sm-2 control-label">应收金额</label>
								<div class="col-sm-9">
									<div class="input-group">
										<input type="text" class="form-control" disabled v-model="info.rece">
										<div class="input-group-addon">元</div>
									</div>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">实收金额</label>
								<div class="col-sm-9">
									<div class="input-group">
										<input type="text" class="form-control" placeholder="实际收取的金额" v-model="info.actual">
										<div class="input-group-addon">元</div>
									</div>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">备注</label>
								<div class="col-sm-9">
									<textarea class="form-control" rows="3" placeholder="简要收费说明" v-model="info.descr"></textarea>
								</div>
							</div>
						</form>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" @click="saveRecord()">保存</button>
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>
		<!-- Modal -->
		<div class="modal fade" id="repast-menu-modal" tabindex="-1" role="dialog"
			aria-labelledby="repastMenuLabel" aria-hidden="true" data-backdrop="static">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
						</button>
						<h4 class="modal-title" id="repastMenuLabel">菜单</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<div class="col-xs-offset-2 col-xs-6">
								<div class="form-group">
									<input type="hidden" id="menu-sels" class="form-control" tabindex="-1" v-model="currSels">
								</div>
							</div>
							<div class="col-xs-4">
								<button class="btn btn-sm btn-primary" type="button" @click="addMenuRecord()"  v-bind:disabled="!currSels">
									<span class="glyphicon glyphicon-pencil"></span>
									生成菜单
								</button>
							</div>
							<div v-show="menu && menu.length>0" class="col-xs-12">
								<table class="table table-hover custom-table" style="margin-bottom: 0;">
									<thead>
										<tr>
											<th>名称</th>
											<th>单价</th>
											<th>数量</th>
											<th>合计</th>
											<th width="120px">操作</th>
										</tr>
									</thead>
									<tbody>
										<tr v-for="item in menu">
											<td>{{item.name}}</td>
											<td>{{item.price | fixed 2 }}</td>
											<td style="width: 140px">
												<div class="input-group">
												    <span class="input-group-btn">
												        <button type="button" class="btn btn-info" data-value="decrease" data-target="#spinner{{$index}}" data-toggle="spinner" v-bind:disabled="item.state==1">
												            <span class="glyphicon glyphicon-minus"></span>
												        </button>
												    </span>
												    <input type="text" data-ride="spinner" id="spinner{{$index}}" class="form-control input-number"
												    	value="{{item.num}}" data-min="1" data-max="99" v-model="item.newnum" v-bind:disabled="item.state==1">
												    <span class="input-group-btn">
												        <button type="button" class="btn btn-info" data-value="increase" data-target="#spinner{{$index}}" data-toggle="spinner" v-bind:disabled="item.state==1">
												            <span class="glyphicon glyphicon-plus"></span>
												        </button>
												    </span>
												</div>
											</td>
											<td>{{(item.price*item.newnum) | fixed 2 }}</td>
											<td>
												<button v-show="item.num!=item.newnum" type="button" class="btn btn-xs btn-primary" @click="saveMenuReocrd(item)">保存</button>
												<button v-show="item.state==0" type="button" class="btn btn-xs btn-danger" @click="delMenuRecord(item.mid)">删除</button>
												<span v-show="item.state==1" class="label label-success">已传菜</span>
											</td>
										</tr>
										<tr>
											<td colspan="4"></td>
											<td colspan="1">总计：{{calcTotal(menu,'price','newnum')}}元</td>
										</tr>
									</tbody>
								</table>
							</div>
							<div v-else class="col-xs-12 text-danger text-center">
								<span class="">该桌尚未点餐</span>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>
				</div>
			</div>
		</div>
		<div id="print-menu" class="col-xs-12">
			<div v-show="prtmenu && prtmenu.length>0" class="col-xs-12">
				<table class="table table-hover custom-table" style="margin-bottom: 0;">
					<thead>
						<tr>
							<th>名称</th>
							<th>单价</th>
							<th>数量</th>
							<th>合计</th>
						</tr>
					</thead>
					<tbody>
						<tr v-for="item in prtmenu">
							<td>{{item.name}}</td>
							<td>{{item.price | fixed 2 }}</td>
							<td>{{item.num }}</td>
							<td>{{(item.price*item.num) | fixed 2 }}</td>
						</tr>
						<tr>
							<td colspan="3"></td>
							<td colspan="1">{{calcTotal(menu,'price','newnum')}}</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div v-else class="col-xs-12 text-danger text-center">
				<span class="">该桌尚未点餐</span>
			</div>
		</div>
	</div>
	<link rel="stylesheet" href="${BASE_PATH}/assets/js/select2/select2.css">
	<link rel="stylesheet" href="${BASE_PATH}/assets/js/select2/select2-bootstrap.css">
	<script type="text/javascript" src="assets/js/laypage.js"></script>
	<script type="text/javascript" src="assets/js/pinyin/pinyin.js"></script>
	<script type="text/javascript" src="assets/js/print/jquery.printarea.js"></script>
	<script type="text/javascript" src="assets/js/spinner/bootstrap-spinner.min.js"></script>
	<script type="text/javascript" src="assets/js/select2/select2.min.js"></script>
	<script type="text/javascript" src="assets/js/biz/repast/manager.js"></script>
#end
#include ("/layout/default.html")